package com.lesso.zgs.sunflower.core;

import lombok.Data;

import java.io.Serializable;

@Data
public class ApiResponse<T> implements Serializable {
    private static final long serialVersionUID = 20250703L;

    public static final int SUCCESS = 1;

    public static final int ERROR = 0;

    private int code;

    private String msg;

    private T data;

    private ApiResponse(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> ApiResponse<T> ok() {
        return new ApiResponse<>(SUCCESS, null, null);
    }

    public static <T> ApiResponse<T> ok(String msg) {
        return new ApiResponse<>(SUCCESS, msg, null);
    }

    public static <T> ApiResponse<T> ok(String msg, T data) {
        return new ApiResponse<>(SUCCESS, msg, data);
    }

}
/*123*/